module.exports = {
  publicPath: './', // 打包路径
  transpileDependencies: true,
  pluginOptions: {
    electronBuilder: {
      preload: 'preload.js', // 👈 必须显式指定
      customFileProtocol: 'app://./', // 使用自定义文件协议
      // 确保渲染进程可以正确加载资源
      rendererProcessFile: './src/main.js',
      builderOptions: {
        appId: "com.yourcompany.printapp",
        productName: "超级打印姬Plus",
        copyright: "Copyright © 2025",
        directories: {
          output: "dist_electron"
        },
        win: {
          icon: "public/icon.png",
          target: [
            {
              target: "nsis",
              arch: ["x64"]
            }
          ]
        },
        nsis: {
          oneClick: false,
          allowToChangeInstallationDirectory: true,
          perMachine: false,
          createDesktopShortcut: true,
          createStartMenuShortcut: true,
          shortcutName: "超级打印姬Plus"
        },
        extraResources: [
          {
            from: "resources",
            to: "resources"
          }
        ],
        asar: false
      },
      // Prevent copying the build configuration to the bundled package.json
      removeBuilderOptions: true
    }
  }
}
